/**
 * @namespace Holds functionality related to events.
 */
lib.event = {};
	
/**
 * Add a listener for the event of the specified type to the specified target.
 * @param {Object} target The target of the event.
 * @param {String} type The type of the event.
 * @param {Function} listener The listener function.
 */
lib.event.listen = function(target, type, listener) {
	if (target.attachEvent) {
		target.attachEvent('on' + type, listener);
	} else {
		target.addEventListener(type, listener, false);
	}
};

/**
 * Remove a listener for the event of specified type from the specified target.
 * @param {Object} target The target of the event.
 * @param {String} type The type of the event.
 * @param {Function} listener The listener function.
 */
lib.event.unlisten = function(target, type, callback) {
	if (target.detachEvent) {
		target.detachEvent('on' + type, listener);
	} else {
		target.removeEventListener(type, listener, false);
	}
};

/**
 * Prevents the default action of an event.
 * @param {Object} event The event object to prevent the default action on.
 */
lib.event.preventDefault = function(event) {
	if (event.preventDefault) {
		event.preventDefault();
	} else {
		event.returnValue = false;
	}
};
